﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX;
using Microsoft.DirectX.AudioVideoPlayback;

namespace WMP
{
    class LecteurV
    {
        private Video audio = null;

        public State state = State.ENDED;

        public void playsound(string name)
        {
            if (audio == null)
                audio = new Video(name, false);
            else
            {
                audio = null;
                audio = new Video(name, false);
            }
            audio.Play();
            state = State.PLAY;
        }

        public void playsound()
        {
            audio.Play();
            state = State.PLAY;
        }

        public void stop()
        {
            audio.Stop();
            state = State.STOP;
        }

        public void pause()
        {
            audio.Pause();
            state = State.PAUSE;
        }

        public State getState()
        {
            if (audio != null && (audio.CurrentPosition >= audio.Duration))
                state = State.ENDED;
            return (state);
        }

    }
}
